package org.maiyodemo.ws;

import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.jws.WebService;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import org.maiyodemo.entity.Cat;
import org.maiyodemo.entity.User;
import org.maiyodemo.service.UserSvc;
import org.maiyodemo.service.UserSvcImpl;
import org.maiyodemo.xmladapter.StringCatXmlAdapter;

@WebService(endpointInterface = "org.maiyodemo.ws.MaiyoWs", serviceName = "MaiyoWebService")
public class MaiyoWsImpl implements MaiyoWs {

	public String sayHi(String name) {
		return "Hello:" + name + " 现在时间:" + new Date();
	}

	public List<Cat> getCatByUser(User user) {
		UserSvc userSvc = new UserSvcImpl();
		return userSvc.getCatByUser(user);
	}

	@XmlJavaTypeAdapter(StringCatXmlAdapter.class)
	public Map<String, Cat> getAllCats() {
		UserSvc userSvc = new UserSvcImpl();
		return userSvc.getAllCats();
	}

}
